<template>
  <div class="wrap">
    <div class="essential-box">
      <div class="pay-title">身份证</div>
      <el-row :gutter="20" class="el-row">
        <el-col :span="24">
          <div class="grid-content height-auto">
            <div class="val">
              <showimg :imgsrc="user_info.idcard_positive_img"></showimg>
              <showimg
                :imgsrc="user_info.idcard_back_img"
                class="ml_20"
              ></showimg>
            </div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="grid-content">
            <div class="key">身份证号：</div>
            <div class="val">{{ certification_info.identity_card }}</div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="grid-content">
            <div class="key">证件有效期：</div>
            <div class="val">{{ certification_info.end_time }}</div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="grid-content">
            <div class="key">发证机关：</div>
            <div class="val">{{ certification_info.authority }}</div>
          </div>
        </el-col>
      </el-row>
      <div class="pay-title">健康证</div>
      <el-row :gutter="20" class="el-row">
        <el-col :span="6">
          <div class="grid-content">
            <div class="key">状态：</div>
            <div class="val">{{ user_info.certificate_health_status_desc }}</div>
          </div>
        </el-col>
        <el-col :span="18">
          <div class="grid-content">
            <div class="key">备注：</div>
            <div class="val">
              {{ certificate_health.fail_reason }}
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="grid-content">
            <div class="key">审核人：</div>
            <div class="val">{{ certificate_health.audit_name }}</div>
          </div>
        </el-col>
        <el-col :span="18">
          <div class="grid-content">
            <div class="key">审核时间：</div>
            <div class="val">{{ certificate_health.last_time }}</div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="grid-content height-auto">
            <div class="val">
              <showimg :imgsrc="user_info.jkz"></showimg>
              <showimg :imgsrc="user_info.jkz2" class="ml_20"></showimg>
            </div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="grid-content">
            <div class="key">发证城市：</div>
            <div class="val">{{ certificate_health.city_name }}</div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="grid-content">
            <div class="key">健康证号：</div>
            <div class="val">{{ certificate_health.health_sn }}</div>
          </div>
        </el-col>
        <el-col :span="24">
          <div class="grid-content">
            <div class="key">证件有效期：</div>
            <div class="val">
              {{ certificate_health.expire_time }}
            </div>
          </div>
        </el-col>
      </el-row>
      <div class="pay-title">其他证件</div>
      <el-row :gutter="20" class="el-row">
        <el-col :span="24">
          <div class="grid-content height-auto">
            <p v-for="(item, index) in fileList" :key="index" class="mr_20">
              <showimg :imgsrc="item.url"></showimg>
            </p>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
const common = require("../../../../static/tool.js");
import { markCover } from "../../../../../assets/js/data.js";
export default {
  name: "IdPhoto",
  props: {
    userInfo: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      head_url: common.head_url,
      user_info: {
        //用户信息
        idcard_positive_img: "/static/img/idcard_positive_img.svg", //身份证正面
        idcard_back_img: "/static/img/idcard_back_img.svg", //身份证反面
        jkz: "/static/img/img.svg", //健康证1
        jkz2: "/static/img/img.svg", //健康证2
      },
      certificate_health: '', //健康证信息
      certification_info: '', //身份证信息
      fileList: [], //其他
    };
  },
  async mounted() {
    this.setValue();
  },
  watch: {
    userInfo() {
      this.setValue();
    },
  },
  methods: {
    setValue() {
      this.user_info = this.userInfo;
      this.certificate_health = this.userInfo.certificate_health
      this.certification_info = this.userInfo.certification_info
      if (this.userInfo.certification_info.front_pic) {
        this.user_info.idcard_positive_img =
          this.head_url +
          this.userInfo.certification_info.front_pic +
          markCover.markCoverImg;
      }
      if (this.userInfo.certification_info.back_pic) {
        this.user_info.idcard_back_img =
          this.head_url +
          this.userInfo.certification_info.back_pic +
          markCover.markCoverImg;
      }
      if (this.userInfo.certificate_health.front_pic) {
        this.user_info.jkz =
          this.head_url + this.userInfo.certificate_health.front_pic;
      }
      if (this.userInfo.certificate_health.back_pic) {
        this.user_info.jkz2 =
          this.head_url + this.userInfo.certificate_health.back_pic;
      }
      if (this.userInfo.certificate_other.length != 0) {
        this.userInfo.certificate_other.forEach(item => {
          item.url = this.head_url + item.img
        })
        this.fileList = this.userInfo.certificate_other
      }
    },
  },
};
</script>

<style scoped lang="scss">
.essential-box {
  margin-bottom: 30px;
}
.essential-box .grid-content {
  display: flex;
  height: auto;
  padding: 10px 0;
  height: 30px;
  line-height: 30px;
}
.essential-box .grid-content .key {
  width: 110px;
  font-size: 13px;
  color: #999999;
  text-align: right;
}
.essential-box .grid-content .val {
  font-size: 14px;
  padding-left: 20px;
  color: #222222;
}
.height-auto {
  height: auto !important;
}
.height-auto .val {
  display: flex;
}
.edit-btn {
  text-align: center;
  margin-top: 20px;
}

.pay-title {
  color: #222222;
  font-size: 14px;
  font-weight: bold;
  padding-bottom: 10px;
  border-bottom: 1px solid #ebebeb;
}
.el-row {
  padding-bottom: 50px;
}
.jurisdiction-set .val {
  display: block;
}
.jurisdiction-set .el-checkbox {
  width: 240px !important;
}
.gray {
  color: #999999;
  font-size: 14px;
}

.imageStyle {
  width: 150px;
  height: 100px;
  margin-right: 10px;
}
</style>



// WEBPACK FOOTER //
// src/components/staff/components/IdPhoto.vue